package com.example.demo.service;

import com.example.demo.dao.UserDao;
import com.example.demo.domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class userService {

    @Autowired
    private UserDao userDao;

    public List<User> getAllUsers() {
        return userDao.selectList(null);
    }

    public void addUser(User user) {
        userDao.insert(user);
    }

    public void deleteUser(Long id) {
        userDao.deleteById(id);
    }

    public void updateUser(User user) {
        userDao.updateById(user);
    }
}
